# kubernetes/postgres.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:12-alpine
          imagePullPolicy: 'IfNotPresent'
          ports:
            - containerPort: 5432
          env:
            - name: PGDATA
              value: '/data/pgdata'
          envFrom:
            - secretRef:
                name: postgres-secrets
          resources:
            limits:
              cpu: 1000m
              memory: 256Mi
            requests:
              cpu: 10m
              memory: 96Mi
          volumeMounts:
            - mountPath: /data
              name: postgresdb
      volumes:
        - name: postgresdb
          persistentVolumeClaim:
            claimName: postgres-storage-claim
